Security News
New Python Packaging Proposal Aims to Solve Phantom Dependency Problem with SBOMs
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
date-easter
Advanced tools
The date-easter npm package is designed to calculate the date of Easter for a given year. It provides functionality to determine the date of Easter Sunday based on different calendar systems, such as the Gregorian and Julian calendars.
Calculate Easter Date (Gregorian Calendar)
This feature allows you to calculate the date of Easter Sunday for a given year using the Gregorian calendar. The code sample demonstrates how to use the `gregorianEaster` function to get the date of Easter in 2023.
const easter = require('date-easter');
const year = 2023;
const easterDate = easter.gregorianEaster(year);
console.log(`Easter in ${year} is on: ${easterDate}`);
Calculate Easter Date (Julian Calendar)
This feature allows you to calculate the date of Easter Sunday for a given year using the Julian calendar. The code sample demonstrates how to use the `julianEaster` function to get the date of Easter in 2023 according to the Julian calendar.
const easter = require('date-easter');
const year = 2023;
const easterDate = easter.julianEaster(year);
console.log(`Easter in ${year} (Julian) is on: ${easterDate}`);
date-fns is a comprehensive library for working with dates in JavaScript. While it does not specifically focus on calculating Easter dates, it provides a wide range of utilities for date manipulation and formatting. It can be used in conjunction with custom logic to calculate Easter dates.
Moment.js is a popular library for parsing, validating, manipulating, and formatting dates in JavaScript. Similar to date-fns, it does not have built-in functionality for calculating Easter dates but offers extensive date manipulation capabilities that can be used to implement such calculations.
easter-date is another npm package specifically designed to calculate the date of Easter Sunday. It provides similar functionality to date-easter, allowing users to determine the date of Easter for a given year using both the Gregorian and Julian calendars.
Calculates Easter for a given year
// ES5
import {easter, gregorianEaster, julianEaster, orthodoxEaster} from 'date-easter'
// cjs
const {easter, gregorianEaster, julianEaster, orthodoxEaster} = require('date-easter')
easter(2016)
// { year: 2016, month: 3, day: 27 }
gregorianEaster(new Date('2016-01-01'))
// { year: 2016, month: 3, day: 27 }
julianEaster(2016)
// { year: 2016, month: 4, day: 18 }
orthodoxEaster(2016)
// { year: 2016, month: 5, day: 1 }
All methods return an object with the following properties
YYYY-MM-DD
Shortcut for gregorianEaster
.
Returns the date of Gregorian Easter for a given year. Uses the extended Gaussian Easter algorithm.
Returns the date of Julian Easter for a given year in the Julian Calender
Returns the date of Julian Easter for a given year in the Gregorian Calender
Copyright (c) 2015 commenthol
Software is released under MIT.
FAQs
Calculates Easter for a given year
We found that date-easter demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
PEP 770 proposes adding SBOM support to Python packages to improve transparency and catch hidden non-Python dependencies that security tools often miss.
Security News
Socket CEO Feross Aboukhadijeh discusses open source security challenges, including zero-day attacks and supply chain risks, on the Cyber Security Council podcast.
Security News
Research
Socket researchers uncover how threat actors weaponize Out-of-Band Application Security Testing (OAST) techniques across the npm, PyPI, and RubyGems ecosystems to exfiltrate sensitive data.